/* eslint-disable */
// 创建混入文件
export function generateMixinCode(data) {
  var json = JSON.stringify(data, null, 2);

  return json;
}

// 创建主文件
export function generateMainCode(vueType) {
  let template = "";
  if (["bbc后台", "bbc门店"].indexOf(vueType) >= 0) {
    //#region
    template = `
<template>
  <div ref="container" class="page-list-container">
    <!--数据Table-->
    <yrt-data-list :ref="dataListRef" v-model:fields="dataListOptions.fields" v-model:data-list-selections="dataListSelections" :editor-ref="editorRef" :data-options="dataOptions" :buttons="dataListOptions.buttons" :button-click="buttonClick" :auth-nodes="authNodes">
    </yrt-data-list>
    <!--数据编辑器Editor-->
    <yrt-editor :ref="editorRef" v-model:action="editorOptions.action" v-model:visible="editorOptions.config.visible" :data-list-ref="dataListRef" :fields="editorOptions.fields" :config="editorOptions.config" :data-options="dataOptions" :detail-button-click="detailButtonClick" :auth-nodes="authNodes">
    </yrt-editor>
  </div>
</template>

<script lang="ts">
import { toRefs, reactive, getCurrentInstance } from "vue";
import baseLayout from "/@/components/common/base-layout.ts";
import yrtDataList from "/@/components/common/yrtDataList.vue";
import yrtEditor from "/@/components/common/yrtEditor.vue";

export default {
	name: "{name}",
	components: {
		yrtDataList, // 数据管理器
		yrtEditor, // 编辑页面
	},
	setup() {
		const { proxy } = getCurrentInstance() as any;
		if (!proxy.isLoaded) {
			proxy.isLoaded = true;
		}
		const base = baseLayout();
		//#region 变量
		const state: any = reactive({});
		//#endregion

		return {
			...base,
			...toRefs(state),
		};
	},
};
</script>

<style lang="scss" scoped>
@import "/@/theme/page.scss";
</style>

    `;
    //#endregion
  } else {
    //#region
    template = `<template>
  <div ref="container" class="page-list-container">
    <!--数据Table-->
    <yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes">
    </yrt-data-list>

    <!--数据编辑器Editor-->
    <yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes">
    </yrt-editor>
  </div>
</template>

<script>
import baseLayout from "@/components/common/base-layout.vue";

export default {
  name: "{name}",
  components: {},
  mixins: [baseLayout],
  data() {
    return {};
  },
  methods: {}
};
</script>
`;
    //#endregion
  }
  return template;
}
